package com.wimcorp.magic.board;

import java.rmi.RemoteException;
import java.util.List;

import com.wimcorp.magic.cards.PlayingCard;
import com.wimcorp.magic.phase.Turn;
import com.wimcorp.magic.players.Player;

public class Hand extends Cards {

	public Hand(Player player, List<PlayingCard> list) {
		super(player);
		for (PlayingCard card : list) {
			add(card);
		}
	}

	public Hand(Player player,PlayingCard... cards) {
		super(player);
		for (PlayingCard card : cards) {
			add(card);
		}
	}

	@Override
	protected void messagePlayersCardAdded(PlayingCard card) {
		if (!Turn.isFirstTurn()) {
			try {
				getPlayer().getUserInterface().message(String.format("You drew : %s ", card.toString()));
				Player opponent = getPlayer().getOpponent();
				if (opponent != null) {
					opponent.getUserInterface().message(String.format("Opponent %s drew a card. ",getPlayer().getName() ));
				}
			} catch (RemoteException e) {
				e.printStackTrace();
			}
		}

	}

}
